//package com.example.java.kafka.es9client;
//
//import co.elastic.clients.elasticsearch.core.BulkRequest;
//import co.elastic.clients.elasticsearch.core.BulkResponse;
//
//public class BatchInsertDoc {
//    public static void main(String[] args) {
//        User user1 = new User("zhangsan", 10, "女");
//        User user2 = new User("lisi", 30, "女");
//        User user3 = new User("wangwu", 40, "男");
//        ConnectElasticsearch.connect(client -> {
//            BulkRequest.Builder bulkRequest = new BulkRequest.Builder();
//            bulkRequest.operations(op ->
//                    op.index(idx -> idx.index("user").id("1001").document(user1))
//            ).operations(op -> op
//                    .index(idx -> idx.index("user").id("1002").document(user2))
//            ).operations(op -> op
//                    .index(idx -> idx.index("user").id("1003").document(user3))
//            );
//            BulkResponse bulkResponse = client.bulk(bulkRequest.build());
//            System.out.println("took: " + bulkResponse.took());
//            System.out.println("errors: " + bulkResponse.errors());
//            System.out.println("items count: " + bulkResponse.items().size());
//        });
//    }
//}